package org.sunflower.controller;

import lombok.Data;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2021-10-07 18:22
 **/
@RestController
@RequestMapping("/hello")
public class HelloController {

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
    public String hello(String username, HelloDto helloDto, HttpServletRequest request) throws InterruptedException {
        System.out.println(username);
        System.out.println(helloDto);
        return "hello";
    }

    @GetMapping("/{path}")
    public String hello(@PathVariable String path) {
        return "hello..." + path;
    }

    @Data
    public static class HelloDto {
        private String username;
    }
}
